home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / graphics / library / wgt51_r2.zip / WGT5 / EXAMPLES / WGT30.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-03  |  2.2 KB  |  55 lines

  1. /*
  2. ==============================================================================
  3.                       WordUp Graphics Toolkit Version 5.0                     
  4.                              Demonstration Program 30                         
  5.                                                                               
  6.  Show how mouse routines may be used in text modes.                          
  7.                                                                               
  8.  *** PROJECT ***                                                             
  9.  This program requires the file WGT5_WC.LIB to be linked.                    
  10.                                                                               
  11.  *** DATA FILES ***                                                          
  12.  NONE                                                                        
  13.                                                            WATCOM C++ VERSION 
  14. ==============================================================================
  15. */
  16.  
  17. #include <wgt5.h>
  18. #include <conio.h>
  19.  
  20.  
  21. void main(void)
  22. {
  23.   short i;                       /* Loop counter */
  24.  
  25.   printf ("WGT Example #30\n\n");
  26.   printf ("Mouse routines are demonstrated in a couple of different text modes.\n");
  27.   printf ("Press a key to end each section of the program.\n");
  28.   printf ("\n\nPress any key to continue.\n");
  29.   getch ();
  30.  
  31.   wsetmode (3);                  /* Color, 80-column text mode */
  32.  
  33.   i = minit ();                  /* Initialize mouse */
  34.   mon ();                        /* Turn on cursor */
  35.   do {
  36.     printf("Mouse coordinates: %i,%i     Button: %i     %c", mouse.mx/4, mouse.my/8, mouse.but, 13);
  37.   } while (!kbhit ());
  38.   moff ();                       /* Hide cursor */
  39.   getch ();
  40.  
  41.   wsetmode (1);                  /* Set to condensed text mode */
  42.   minit ();
  43.  
  44.   mon ();                        /* Turn on cursor */
  45.   do {
  46.     printf ("Mouse coordinates: %2i,%2i     Button: %2i%c", mouse.mx/8, mouse.my/8, mouse.but, 13);
  47.   } while (!kbhit ());
  48.   moff ();                       /* Hide cursor */
  49.   mdeinit ();                    /* Deinitialize the mouse handler */
  50.  
  51.   printf ("\n");
  52.   getch ();
  53.   wsetmode (3);                /* Return to 80-column text mode */
  54. }
  55.